﻿var XmlHttp;
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        XmlHttp = new XMLHttpRequest();
    }
}


function sendAJAX() {
    var name = document.getElementById("textfield_name").value;
    var pass = document.getElementById("textfield_pass").value;
    if (name == "" || pass == "") {
        document.getElementById("message").innerHTML = "登录信息不能为空";
    }
    else {
        createXMLHttpRequest();
        XmlHttp.onreadystatechange = ServerProcess;
        XmlHttp.Open("get", "Handle/Login.ashx?name=" + name + "&pass=" + pass, true);
        XmlHttp.send(null);
    }
}


function ServerProcess() {
    if (XmlHttp.readyState == 4) {
        if (XmlHttp.status == 200) {
            if (XmlHttp.responseText.toString() == "用户名或密码错误！")
                document.getElementById("message").innerHTML = XmlHttp.responseText;
            else
                this.window.location.href = "FinancialDefault.htm";
        }
    }
}


